package nl.hanze.designpatterns.mvc.view;

import javax.swing.JPanel;

import nl.hanze.designpatterns.mvc.controller.Controller;

public abstract class View<C,M> extends JPanel{

	private C controller;
	private M model;
	
	protected View(C controller, M model){
		this.setController(controller);
		this.setModel(model);
	}
	
	/**
	 * Set the controller
	 * @param controller
	 */
	public void setController(C controller){
		this.controller = controller;
	}
	
	/**
	 * Set the model
	 * @param model
	 */
	public void setModel(M model){
		this.model = model;
	}
	
	/**
	 * Get the controller
	 * @return
	 */
	public C getController(){
		return this.controller;
	}
	
	/**
	 * Get the model
	 * @return
	 */
	public M getModel(){
		return this.model;
	}
	
	/**
	 * Notify this view that it's associated model has changed
	 */
	abstract public void notifyChange();
}
